package com.wulijie.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * @Author cui
 * @Data
 */
public class Output {
    private List<College> colleges;

    public Output(List<College> departmentList) {
        this.colleges = departmentList;
    }

    public void printIt() {
        Iterator<College> iterator = this.colleges.iterator();
        while (iterator.hasNext()) {
            College nexted = iterator.next();
            System.out.println("======" + nexted.getName() + "======");
            Iterator iterator1 = nexted.createIterator();
            while (iterator1.hasNext()) {
                Department department = (Department) iterator1.next();
                System.out.println(department.getName());
            }
        }
    }
}
